package kr.saeildamil.androidstudy.ch12;

import java.util.ArrayList;

import kr.saeildamil.androidstudy.R;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;

public class ListOnly extends ListActivity {
	ArrayList<MyItem> arList;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		arList = new ArrayList<MyItem>();
		arList.add(new MyItem(R.drawable.suzy, "삼성노트북"));
		arList.add(new MyItem(R.drawable.suzy, "LG 세탁기"));
		arList.add(new MyItem(R.drawable.suzy, "대우 마티즈"));
		
		MyListAdapter adapter = new MyListAdapter(this, R.layout.ch12_icontext, arList);
		setListAdapter(adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		Toast.makeText(this, arList.get(position).name, Toast.LENGTH_LONG).show();
	}
}
